<%@ Page Language="C#" EnableViewState="false" ValidateRequest="false" AutoEventWireup="true" 
	Inherits="Syrinx.Gui.AspNet.Ajax.NitobiBasePage" MasterPageFile="~/App_ThemeMasters/NoStyle/AdminOneColumnLayout.Master" EnableEventValidation="false" %>

<%@ Register Assembly="Swaf.Gui.AspNet2" Namespace="Swaf.Gui.AspNet2" TagPrefix="swf" %>
<%@ Register Assembly="ScsAspNet" Namespace="Syrinx.Gui.AspNet.Ajax" TagPrefix="saj" %><%@ Register Assembly="NitobiControls" Namespace="Nitobi" TagPrefix="ntb" %>
<%@ Register Assembly="ScsAspNet" Namespace="Articles.Gui.AspNet" TagPrefix="art" %>

<!--#include file="~/SiteControls/RegisterStandardControls.txt"-->
<!--#include file="../SiteControls/StandardAdminHeaderPageContent.inc"-->
<!--#include file="../SiteControls/StandardFooterPageContent.inc"-->

<script runat="server">
	public string TitleFormat = "$company.name$ - Backup/Restore Management";
</script>

<asp:Content ID="c1" ContentPlaceHolderID="title" runat="server">
	<%SecurityPrivilege = "AppFunctions.ManageCompanyConfiguration"; %>
    <h1 ID="_title" runat="server">Backup/Restore Management</h1>
	<div class="HelpBtnArea" style="float:right">
		<asp:HyperLink runat="server" ID="_pageHelp" NavigateUrl="../std/Help.aspx?helpid=BackupRestoreHelp" Target="help">Help</asp:HyperLink>
	</div>
    <swf:BizProc ID="backup" runat="server" FactoryName="companyBackupRestore" />
    
<%-- Only needed when the company has rights to have children, otherwise they can only backup
     their own company and wont need to see a list of child companies to choose to backup together. --%>
    <swf:BizProc ID="backupCompanies" runat="server" FactoryName="backupCompanies">
		<ParentBizProc id="backup" fieldName="backupCompanies" dataId="pid" fullDependency="true" />
    </swf:BizProc>
    <swf:BizProc ID="restoreCompanies" runat="server" FactoryName="restoreCompanies">
		<ParentBizProc id="backup" fieldName="origionalBackupCompanies" dataId="masterList" />
		<ParentBizProc id="backup" fieldName="restoreCompanies" dataId="pid" fullDependency="true" />
    </swf:BizProc>
<%-- ---------------------------------------------------------------------------------------------- --%>
</asp:Content>

<asp:Content ID="c3" ContentPlaceHolderID="mainContent" runat="server">
	<span class="button2"><saj:ActionButton runat="server" ID="cancelBtn" Actions="backup.UpdateBizObj" Text="Create Backup" /></span>
	<span class="button2"><saj:ActionButton runat="server" ID="restoreBtn" Actions="backup.Restore" Text="Restore Backup" /></span>
	<span class="button5"><saj:ActionButton runat="server" ID="deleteBtn" Actions="backup.DeleteBizObj" Text="Delete Backup" ClientClick="if(!confirm('Are you sure you want to delete?'))return false;"/></span>
	<table>
	<tr><td>
		<h2><asp:Label runat="server" ID="_bklstLbl">Existing Backups</asp:Label></h2>
		<saj:Grid  ID="rl1" runat="server" Width="200px" Height="250px"  
			ShowToolbar="false" ParentBizProcIds="backup" Mode="LiveScrolling">
			<Columns>
				<ntb:KeyColumn DataField="id" />
				<ntb:DateColumn DataField="dateCreated" HeaderText="Created On" width="180"  />
			</Columns>
		</saj:Grid>		
	</td><td width="20px">&nbsp;</td><td>
		<h2><asp:Label runat="server" ID="_bkoptnsLbl">Backup/Restore Options</asp:Label></h2>
		<saj:NitobiBizObjDisplay ID="rd1" runat="server"
			TemplateNameBizRule="getBackupRestoreDeploymentOtionDisplay" ParentBizProcIds="backup" />
	</td></tr>
	</table>
			
<%-- Only needed when the company has rights to have children, otherwise they can only backup
     their own company and wont need to see a list of child companies to choose to backup together. --%>
	<span class="button2"><saj:ActionButton runat="server" ID="_toggleCompanies" Actions="backupCompanies.MasterDataOption" Text="Toggle" /></span>
	<table>
	<tr><td>
	<h2><asp:Label runat="server" ID="_bdLbl">Companies in Backup</asp:Label></h2>
	<div style="height:200px;width:250px;overflow:auto;border:solid 1px black;">
	<saj:ComplexBizObjListDisplay ID="bc1" runat="server" ParentBizProcIds="backupCompanies"
		ReadOnlyTemplate="BackupRestoreDeploy.Gui.AspNet.BackupCompanyListDisplay" />
	</div>
	</td><td width="20px">&nbsp;</td><td>
	<h2><asp:Label runat="server" ID="Label1">Company to Restore From</asp:Label></h2>
	<div style="height:200px;width:250px;overflow:auto;border:solid 1px black;">
	<saj:ComplexBizObjListDisplay ID="rc1" runat="server" ParentBizProcIds="restoreCompanies"
		ReadOnlyTemplate="BackupRestoreDeploy.Gui.AspNet.RestoreCompanyListDisplay" />
	</div>
	</td></tr>
	</table>
<%-- ---------------------------------------------------------------------------------------------- --%>	
</asp:Content>
